home *** CD-ROM | disk | FTP | other *** search
- >Just a quick question here.
- >
- >I want to be able to use the RND() function to create random numbers, yet
- >have those "random" numbers the same under certain circumstances. See, I
- >want the user to be able to specify a "seed" number, so that inputting the
- >same "seed" will provide the same results. Should I use RANDOMIZE SEED???
-
- No - that won't work (although it's supposed to - bug #153). You'll have
- to use this random number routine:
-
- Procedure RAND[_MAX]
- HI=SEED/127773
- LO=SEED mod 127773
- TEST=16807*LO-2836*HI
- If TEST>=0
- SEED=TEST
- Else
- SEED=TEST+2147483647
- End If
- R#=SEED/2147483647.0
- R=R#*_MAX
- End Proc[R]
-
- --Andy Church
-
-